<template>
 <!--pages/login/index.wxml-->
 <view class="apply_box">
  <mineNavbar :styleData="styleData"></mineNavbar>
  <scroll-view class="a_contain" v-if="applyList.length" scroll-y @scrolltolower="scrollBottomFn">
   <view v-for="item in applyList" :key="item" class="c_box" @click="goDetail(item)">
    <view class="b_top">
     <image :src="item.url" mode="scaleToFill" />
     <view class="right">
      <view class="top">{{ item.fullName }}</view>
      <view class="bottom">
       <text>{{ item.industrySector }} </text>
       <text class="text">|</text>
       <text>{{ item.enterpriseNature }} </text>
       <text class="text">|</text>
       <text>{{ item.enterpriseScale }}</text>
      </view>
     </view>
    </view>
    <view class="b_bottom">
     <text>{{ item.provinceLabel || '' }}-{{ item.cityLabel }}-{{ item.areaLabel }}</text>
    </view>
   </view>
   <view class="downLoad">-- 加载完成，共{{ applyList.length }}条数据 --</view>
  </scroll-view>
  <noneState v-else></noneState>
 </view>
</template>
  
<script>

import { lookMe } from "@/api/pages/mine.js"
import noneState from '@/pages/recruit/components/noneState.vue'

export default {
 components: { noneState },
 data() {
  return {
   styleData: {
    show: true,
    tabbarText: '看过我的企业'
   },
   pageSize: 10,
   pageNum: 1,
   pageTotal: 1,
   activeType: 1,
   applyList: []
  };
 },
 computed: {},
 watch: {},
 async onLoad(options) {
  this.getMyLookListFun()
 },
 async onShow() {
  this.pageNum = 1
 },
 onReady() { },
 methods: {
  //获取我的收藏列表
  getMyLookListFun() {
   lookMe({ pageNum: this.pageNum, pageSize: this.pageSize }).then((res) => {
    if (res.code == 200) {
     this.pageTotal = Math.ceil(res.total / this.pageSize)
     if (this.pageNum === 1) {
      this.applyList = res.rows
     } else {
      res.rows.forEach((suc) => {
       this.applyList.push(suc)
      })
     }
    }
   })
  },
  // 监听滑动到底部
  scrollBottomFn() {
   this.pageNum += 1
   if (this.pageNum <= this.pageTotal) {
    this.getMyLookListFun()
   } else {
    uni.showToast({
     title: '没有更多了',
    });
   }
  },
  // 跳转详情页
  goDetail(item) {
   uni.setStorageSync('enterpriseDetail', item)
   uni.navigateTo({
    url: "/subPage/enterprise/mine/enterpriseDetail/index?enterpriseId=" + item.enterpriseId,
   });
  }
 },
};
</script>
<style lang="scss" scoped>
/* pages/login/index.wxss */
.apply_box {
 width: 100%;
 height: 100vh;

 .a_contain {
  width: 100%;
  height: calc(100vh - 140rpx);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  .c_box {
   width: 702rpx;
   height: 220rpx;
   padding: 24rpx;
   box-sizing: border-box;
   background: #fff;
   border-radius: 16rpx;
   margin: 24rpx;

   .b_top {
    display: flex;
    align-items: center;

    >image {
     width: 80rpx;
     height: 80rpx;
     border-radius: 15rpx;
    }

    .right {
     margin-left: 20rpx;

     .top {
      font-weight: 500;
      font-size: 28rpx;
      color: #000000e0;
      margin-bottom: 10rpx;
     }

     .bottom {
      font-weight: 500;
      font-size: 24rpx;
      color: #00000073;

      .text {
       margin: 0 10rpx;
      }
     }
    }

   }

   .b_bottom {
    display: flex;
    margin-top: 55rpx;
    align-items: center;


    text {
     margin-left: 10rpx;
     font-weight: 500;
     font-size: 24rpx;
     color: #000000a3;
    }
   }
  }
 }

 .downLoad {
  font-size: 24rpx;
  color: #00000033;
  width: 100%;
  height: 80rpx;
  line-height: 80rpx;
  text-align: center;
  margin-bottom: 20rpx;
 }
}
</style>
  